#ifndef __DAC_H__
#define __DAC_H__	 
#include <mqx.h>
#include <bsp.h>


#define DAC_NORMAL_MODE			0x00u
#define DAC_SWING_MODE			0x02u
#define DAC_ONCE_MODE			0x04u

#define DAC_WATERMARK_1			0x00u
#define DAC_WATERMARK_2			0x08u
#define DAC_WATERMARK_3			0x10u
#define DAC_WATERMARK_4			0x18u

#define DAC_BUFFER_ENABLE		0x01u
#define DAC_BUFFER_DISABLE		0x00u


#define DAC_REF_VREFO			0x00u
#define DAC_REF_VDDA			0x40u


#define DAC_LOW_POWER			0x08u
#define DAC_HIGH_POWER			0x00u

#define DAC_SOFTWARE_TRIGGER            0x20u
#define DAC_HARDWARE_TRIGGER            0x00u

#define DAC_WATERMASK                   0x04u
#define DAC_TOP                         0x02u
#define DAC_BOTTOM                      0x01u

extern void
DACEnable(DAC_MemMapPtr ptrDAC);
extern void
DACDisable(DAC_MemMapPtr ptrDAC);
extern void
DACReferenceSet(DAC_MemMapPtr ptrDAC, unsigned long ulRef);
extern void
DACTiggerModeSet(DAC_MemMapPtr ptrDAC, unsigned long ulMode);
extern void
DACPowerSet(DAC_MemMapPtr ptrDAC, unsigned long ulPower);
extern void
DACDataPut(DAC_MemMapPtr ptrDAC, unsigned char ucIndex, unsigned short usData);
unsigned short
DACDataGet(DAC_MemMapPtr ptrDAC, unsigned char ucIndex);
extern void
DACTrigger(DAC_MemMapPtr ptrDAC);
extern void
DACBufferConfigure(DAC_MemMapPtr ptrDAC, unsigned long ulConfig, 
		   unsigned long ulBufferUpLimit, unsigned long ulBufferInitPoint);
extern void
DACIntEnable(DAC_MemMapPtr ptrDAC, unsigned long ulInt);
extern void
DACIntDisable(DAC_MemMapPtr ptrDAC, unsigned long ulInt);
extern void
DACIntClear(DAC_MemMapPtr ptrDAC, unsigned long ulInt);
extern unsigned char
DACIntStatus(DAC_MemMapPtr ptrDAC);

#endif //  __DAC_H__
